1. Field of the Invention
The present invention relates to an apparatus, a method, and a computer readable medium thereof for drawing a 3D water surface. More specifically, it relates to an apparatus, a method, and a computer readable medium thereof for drawing a 3D water surface according to an actual water surface height.
2. Descriptions of the Related Art
With the growth of the science and technology, the life of people depends on the science and technology more and more. The 3D animation frequently appears in movies and computer games nowadays. Due to the maturity of the image technology, a picture of the 3D animation almost approximates the real-world view. Among 3D images, the image of a water surface is one of difficult 3D images to present. In addition to the wave shape of the water surface, there is also light change on the water surface. Hence, it is one important step to generate a reflection effect and a refraction effect of the water surface. In general, the reflection effect and the refraction effect are generated based on the following equation:Cresult=F(θ)*Creflect+(1−F(θ))*Crefract  (1)wherein Cresult is the color of the water surface, Creflect and Crefract are the reflection color and the refraction color respectively, and F(θ) is Fresnel coefficient. Generally speaking, the reflection can be divided into two parts: the environment reflection Cenvironment and the object reflection Clocalreflect. They can be represented by the following equation;Creflect=Cenvironment+Clocalreflect  (2)Cenvironment and Clocalreflect are mapped on the water surface via reflection vectors and projection vectors. To further show the change of the depth of the water, the refraction colors of the object in the water also need considering. The following equation can be used:Crefract=e−f(y)*Cobjectcolor+(1−e−f(y))*Cwatercolor  (3)wherein Cobjectcolor is the original color of the object, Cwatercolor is the color of the object in the water, and e−f(y) is a ratio coefficient for mixing the two colors.
FIG. 1 is a conventional apparatus 1 for drawing a water surface image. The apparatus 1 comprises a database 10, a reflection image generation module 11, a refraction image generation module 12, and an image mergence module 13. The database 10 stores a water wave map 16. The reflection image generation module 11 and the refraction image generation module 12 respectively generate a reflection image 14 and a refraction image 15 according to a fixed water height, wherein the fixed water height is the surface when the water is calm. After that, the image mergence module 13 utilizes the equation (1) to merge the water wave map 16, the reflection image 14, and the reflection image 15 into a water surface image 17.
The conventional apparatus 1 does not consider the actual water surface height when the reflection image 14 and the refraction image 15 are generated. More particularly, the conventional apparatus 1 sets the water surface height, y axis, is always 0 to generate the reflection image 14 and the refraction image 15. However, it only occurs when the water is calm. If the water has big waves, the errors of displaying the image of the water surface occur. As the FIG. 2 shows, bubbles 21, supposed to be around a rock 20, is not around the rock 20 and a refraction 22 of the part of rock 20 under the water apparently breaks off the position of the rock 20. Another error as shown in FIG. 3 is that the conventional apparatus 1 erroneously determines the refraction as the reflection 30. The errors shown in FIG. 2 and FIG. 3 occur because the reflection image and the refraction image are generated according to the fixed water height, but not the actual water height.
Consequently, how to represent an actual water surface and make the 3D animation is closer to the real water to increase the value of the 3D animation industry is still an object for the industry to endeavor.